﻿@using ZR.CodeGenerator
@using ZR.Model.System.Generate
@* @model ZR.CodeGenerator.Model.GenerateDto; 2*@
@{
    var genTable = Model.GenTable;
    List<GenTableColumn> listCols = genTable.ListItemColumns;
    var genTableOptions=genTable.Options;
    var subTableOptions = Model.SubTableOptions;
    var replaceDto = Model.ReplaceDto;
}
@foreach(var column in listCols)
{
    var labelName = "";
    var checkboxHtml = "";
    var showToolTipHtml = "";
    var columnName = column.CsharpFieldFl;
    if(column.CsharpType == "string" || column.HtmlType == "datetime")
    {
        showToolTipHtml = " :show-overflow-tooltip=\"true\"";
    }
    if (column.FieldDesc != "")
    {
        labelName = column.FieldDesc;
    }
    else
    {
        labelName = column.CsharpFieldFl;
    }
    if(column.IsPk==true)
    {
        continue;
    }
    if (genTableOptions.IsTreeTable && column.CsharpField == genTableOptions.TreeTableNodePaIdField)
    {
<el-table-column prop="pa@(genTableOptions.TreeTableNodeNameField)" label="@(labelName)" align="center" />
        continue;
    }
    if (genTableOptions.IsShowLeftTree && column.CsharpField == genTableOptions.LeftTreeNodeIdField)
    {
<el-table-column prop="belong@(genTableOptions.LeftTreeNodeNameField)" label="@(labelName)" align="center" />
        continue;
    }
    if (column.HtmlType == "customInput" && column.IsPk == false)
    {
<el-table-column prop="@(columnName)" label="@(labelName)" width="90" sortable align="center">
    <template slot-scope="scope">
        <span v-show="editIndex != scope.$index" @@click="editCurrRow(scope.$index,'rowkeY')">{{scope.row.@(columnName)}}</span>
        <el-input :id="scope.$index+'rowkeY'" size="mini" v-show="(editIndex == scope.$index)"
                    v-model="scope.row.@(columnName)" @@blur="handleChangeSort(scope.row)"></el-input>
    </template>
</el-table-column>
    }
    else if (column.HtmlType == "imageUpload")
    {
<el-table-column prop="@(columnName)" label="@(labelName)" align="center">
    <template slot-scope="scope">
        <el-image class="table-td-thumb" fit="contain" :src="scope.row.@(columnName)" :preview-src-list="[scope.row.@(columnName)]">
            <div slot="error"><i class="el-icon-document" /></div>
        </el-image>
    </template>
</el-table-column>
    }
    else if (column.HtmlType == "checkbox" || column.HtmlType == "select" || column.HtmlType == "radio" || column.HtmlType == "radioBtn")
    {
<el-table-column prop="@(columnName)" label="@(labelName)" align="center">
    <template slot-scope="scope">
        @if(genTableOptions.IsHasEnableStateField && column.CsharpField==genTableOptions.StateCodeField)
        {
        <el-switch v-model="scope.row.@(columnName)" :active-value="'Enabled'" :inactive-value="'Disabled'" @@change="handleStatusChange(scope.row)"></el-switch>
        }
        else
        {
            if (column.HtmlType == "checkbox")
            {
        <dict-tag :options="@(column.DictType != " "?column.DictType:$" {column.CsharpFieldFl}Options")" :value="scope.row.@(columnName) ? scope.row.@(columnName).split(',') : []" />
            }
            else
            {
        <dict-tag :options="@(column.DictType != " "?column.DictType:$" {column.CsharpFieldFl}Options")" :value="scope.row.@(columnName)" />
            }
        }
    </template>
</el-table-column>
    }
    else
    {
<el-table-column prop="@(columnName)" label="@(labelName)" align="center" @(showToolTipHtml) />
    }

}
